{% if href and props %}
<ul>
  {% for ace in props.acl.aceList %}
  <li>
    <span>{{ace.principal.TYPE}}</span>
    <span class="buttonset">
      <input type="checkbox"
	     id="{{href}}-{{ace.principal.TYPE}}-read"
	     {% if ace.grant %}
	     {% for privilege in ace.grant.privilegeList %}
	     {% if '{DAV:}read' in privilege %}
	     checked
	     {% endif %}
	     {% endfor %}
	     {% endif %}
	     onclick="grantIt('{{href}}', '{{ace.principal.XML}}', '<read/>', this.checked);" />
      <label for="{{href}}-{{ace.principal.TYPE}}-read">读</label>
      <input type="checkbox"
	     {% if ace.grant %}
	     {% for privilege in ace.grant.privilegeList %}
	     {% if '{DAV:}write' in privilege %}
	     checked
	     {% endif %}
	     {% endfor %}
	     {% endif %}
	     id="{{href}}-{{ace.principal.TYPE}}-write"
	     onclick="grantIt('{{href}}', '{{ace.principal.XML}}', '<write/>', this.checked);" />
      <label for="{{href}}-{{ace.principal.TYPE}}-write">写</label>
      <input type="checkbox"
	     {% if ace.grant %}
	     {% for privilege in ace.grant.privilegeList %}
	     {% if '{DAV:}bind' in privilege %}
	     checked
	     {% endif %}
	     {% endfor %}
	     {% endif %}
	     id="{{href}}-{{ace.principal.TYPE}}-bind"
	     onclick="grantIt('{{href}}', '{{ace.principal.XML}}', '<bind/>', this.checked);" />
      <label for="{{href}}-{{ace.principal.TYPE}}-bind">绑定</label>
      <input type="checkbox"
	     id="{{href}}-{{ace.principal.TYPE}}-write-acl"
	     {% if ace.grant %}
	     {% for privilege in ace.grant.privilegeList %}
	     {% if '{DAV:}write_acl' in privilege %}
	     checked
	     {% endif %}
	     {% endfor %}
	     {% endif %}
	     onclick="grantIt('{{href}}', '{{ace.principal.XML}}', '<write-acl/>', this.checked);" />
      <label for="{{href}}-{{ace.principal.TYPE}}-write-acl">修改权限</label>
    </span>
  </li>
  {% endfor %}
  <li class="ui-widget">
    <label for="{{href}}-add-pv-user">指定</label>
    <input class="principalList" id="{{href}}-add-pv-user">
    <button class="button" onclick="grantIt('{{href}}', '<principal><href>' + $(this).prev().val() + '</href></principal>', '', true);">增加</button>
  </li>
</ul>
<script type="text/javascript">
	$(".buttonset").buttonset();
	$(".principalList").autocomplete({
		source: '{{request.path}}?action=search&type=principal'
	    });
</script>
{% else %}
You have no privilege.
{% endif %}
